<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <meta content="HTML Tidy for Cygwin (vers 1st February 2003), see www.w3.org" name="generator">
    <meta name="keywords" content="electronic commerce, ecommerce, ebusiness, e-business, e-commerce, enterprise software, net economy, Netscape, Sun Microsystems, DevEdge Archive, iPlanet, internet software">
    <meta name="description" content="The DevEdge Archive, a strategic alliance formed by America Online and Sun Microsystems, Inc., is delivering iPlanet e-commerce software and enterprise solutions that enable companies to compete successfully in the Net Economy">
    <meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
    <meta name="TEMPLATEBASE" content="Authored in FrameMaker. Converted to HTML in WebWorks Publisher 2000. manual wdt 1.5">
    <meta name="LASTUPDATED" content="09/28/00 13:15:53">
    <title>
      Core JavaScript Reference 1.5:
    </title>
    <link rel="stylesheet" type="text/css" href="js15ref.css">
  </head>
  <body>
    <table width="100%" border="0" cellspacing="4">
      <tr>
        <td valign="top">
          <b><a class="sansserifPurple" href="packages.html">Previous</a></b>&nbsp;&nbsp;&nbsp;&nbsp; <a href="contents.html"><b class="sansserifPurple">Contents</b></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="ix.html"><b class="sansserifPurple">Index</b></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="string.html"><b class="sansserifPurple">Next</b></a> &nbsp;&nbsp;&nbsp;&nbsp;
        </td>
      </tr>
      <tr>
        <td class="sansserifBlack" valign="top" align="right" bgcolor="#CCCCCC">
          <b>Core JavaScript Reference 1.5</b>
        </td>
      </tr>
    </table><br>
     
    <blockquote>
      <br>
      <br>
      <br>
      <br>
       
      <p>
        <a name="1193136" id="1193136"></a> <a name="RegExp" id="RegExp"></a> <span class="sansserif"><b>RegExp</b></span>
      </p>
      <p>
        <a name="1193138" id="1193138"></a> <span class="sansserif">A regular expression object contains the pattern of a regular expression. It has properties and methods for using that regular expression to find and replace matches in strings.</span>
      </p>
      <p>
        <a name="1193139" id="1193139"></a> <span class="sansserif">In addition to the properties of an individual regular expression object that you create using the <span class="mono">RegExp</span> constructor function, the predefined <span class="mono">RegExp</span> object has static properties that are set whenever any regular expression is used.<br></span>
      </p><br>
       
      <table width="90%" border="1" cellpadding="5" cellspacing="0">
        <tr>
          <td valign="top" colspan="2" rowspan="1">
            <p>
              <a name="1193142" id="1193142"></a> <span class="sansserif"><i>Core object</i></span>
            </p>
          </td>
        </tr>
        <tr>
          <td valign="top">
            <p>
              <a name="1193146" id="1193146"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
            </p>
          </td>
          <td valign="top">
            <p>
              <a name="1193148" id="1193148"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span>
            </p>
            <p>
              <a name="1195460" id="1195460"></a>
            </p>
            <p>
              <a name="1193152" id="1193152"></a> <span class="sansserif">JavaScript 1.3: added <a href="regexp.html#1194174">toSource</a> method.</span>
            </p>
            <p>
              <a name="1207367" id="1207367"></a>
            </p>
            <p>
              <a name="1207371" id="1207371"></a> <span class="sansserif">JavaScript 1.5, NES 6.0: added <span class="mono">m</span> flag, non-greedy modifier, non-capturing parentheses, lookahead assertions. ECMA 262, Edition 3</span> &nbsp;
            </p>
          </td>
        </tr>
      </table>
      <p>
        <br>
         <a name="1193153" id="1193153"></a> <a name="Created by" id="Created by"></a> <span class="sansserif"><b>Created by</b></span><br>
         <a name="1193154" id="1193154"></a> <span class="sansserif">A literal text format or the <span class="mono">RegExp</span> constructor function.</span>
      </p>
      <p>
        <a name="1193155" id="1193155"></a> <span class="sansserif">The literal format is used as follows:</span>
      </p>
      <p>
        <a name="1193156" id="1193156"></a> <span class="mono">/<i>pattern</i>/<i>flags</i></span>
      </p>
      <p>
        <a name="1193157" id="1193157"></a> <span class="sansserif">The constructor function is used as follows:</span>
      </p>
      <p>
        <a name="1193158" id="1193158"></a><span class="mono">new RegExp("<i>pattern</i>"[, "<i>flags</i>"])</span>
      </p>
      <p>
        <br>
         <a name="1193159" id="1193159"></a> <a name="Parameters" id="Parameters"></a> <span class="sansserif"><b>Parameters</b></span><br>
         <a name="1193172" id="1193172"></a> <span class="sansserif"><br></span>
      </p><br>
       
      <table width="90%" border="1" cellpadding="5" cellspacing="0">
        <tr>
          <td valign="top">
            <a name="1193162" id="1193162"></a> <span class="mono">pattern</span> 
            <p>
              &nbsp;
            </p>
          </td>
          <td valign="top">
            <p>
              <a name="1193164" id="1193164"></a> <span class="sansserif">The text of the regular expression.</span> &nbsp;
            </p>
          </td>
        </tr>
        <tr>
          <td valign="top">
            <a name="1193166" id="1193166"></a> <span class="mono">flags</span> 
            <p>
              &nbsp;
            </p>
          </td>
          <td valign="top">
            <p>
              <a name="1193168" id="1193168"></a> <span class="sansserif">If specified, flags can have any combination of the following values:</span>
            </p>
            <ul>
              <li class="nobullet">
                <a name="1193169" id="1193169"></a>
              </li>
              <li>
                <span class="sansserif"><span class="mono">g</span>: global match</span> 
                <p>
                  <a name="1193170" id="1193170"></a>
                </p>
              </li>
              <li>
                <span class="sansserif"><span class="mono">i</span>: ignore case</span> 
                <p>
                  <a name="1207375" id="1207375"></a>
                </p>
              </li>
              <li>
                <span class="mono">m</span>: match over multiple lines
              </li>
            </ul>&nbsp;
          </td>
        </tr>
      </table>
      <p>
        <a name="1193173" id="1193173"></a> <span class="sansserif">Notice that the parameters to the literal format do not use quotation marks to indicate strings, while the parameters to the constructor function do use quotation marks. So the following expressions create the same regular expression:</span>
      </p>
      <p>
        <a name="1193174" id="1193174"></a> <span class="mono">/ab+c/i<br>
         new RegExp("ab+c", "i")</span>
      </p>
      <p>
        <br>
         <a name="1193175" id="1193175"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
         <a name="1193176" id="1193176"></a> <span class="sansserif">When using the constructor function, the normal string escape rules (preceding special characters with \ when included in a string) are necessary. For example, the following are equivalent:</span>
      </p>
      <p>
        <a name="1193177" id="1193177"></a><span class="mono">re = new&nbsp;RegExp("\\w+")<br>
         re = /\w+/</span>
      </p>
      <p>
        <a name="1193181" id="1193181"></a> <span class="sansserif">The following table provides a complete list and description of the special characters that can be used in regular expressions.</span>
      </p>
      <p>
        <a name="1195218" id="1195218"></a> <span class="sansserif"><br></span>
      </p>
      <p>
        <span {font-family: (null)}"><b><a name="1193188" id="1193188"></a> <a name="Special characters in regular expressions. &nbsp;" id="Special characters in regular expressions. #160;"></a></b></span>
      </p>
      <align>
        <span {font-family: (null)}"><b class="sansserif">Table 1.1 &nbsp;&nbsp; Special characters in regular expressions. &nbsp;
        </b></span><br>
        <br>
         
        <table>
          <tr bgcolor="#CCCCCC" align="left" valign="top">
            <th valign="top" align="left">
              <a name="1193192" id="1193192"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Character</b></span>
              </p>
            </th>
            <th valign="top" align="left">
              <a name="1193194" id="1193194"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Meaning</b></span>
              </p>
            </th>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193196" id="1193196"></a> <span class="mono">\</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193198" id="1193198"></a> <span class="sansserif">For characters that are usually treated literally, indicates that the next character is special and not to be interpreted literally.</span>
              </p>
              <p>
                <a name="1193199" id="1193199"></a> <span class="sansserif">For example, <span class="mono">/b/</span> matches the character 'b'. By placing a backslash in front of b, that is by using <span class="mono">/\b/</span>, the character becomes special to mean match a word boundary.</span>
              </p>
              <p>
                <a name="1193200" id="1193200"></a> <span class="sansserif">-or-</span>
              </p>
              <p>
                <a name="1193201" id="1193201"></a> <span class="sansserif">For characters that are usually treated specially, indicates that the next character is not special and should be interpreted literally.</span>
              </p>
              <p>
                <a name="1193202" id="1193202"></a> <span class="sansserif">For example, <span class="mono">*</span> is a special character that means 0 or more occurrences of the preceding character should be matched; for example, <span class="mono">/a*/</span> means match 0 or more a's<span class="mono">.</span> To match <span class="mono">*</span> literally, precede the it with a backslash; for example, <span class="mono">/a\*/</span> matches 'a*'.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193204" id="1193204"></a> <span class="mono">^</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193206" id="1193206"></a> <span class="sansserif">Matches beginning of input. If the multiline flag is set to true, also matches immediately after a line break character.</span>
              </p>
              <p>
                <a name="1193207" id="1193207"></a> <span class="sansserif">For example, <span class="mono">/^A/</span> does not match the 'A' in "an A", but does match the first 'A' in "An A."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193209" id="1193209"></a> <span class="mono">$</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208350" id="1208350"></a> <span class="sansserif">Matches end of input. If the multiline flag is set to true, also matches immediately before a line break character.</span>
              </p>
              <p>
                <a name="1193212" id="1193212"></a> <span class="sansserif">For example, <span class="mono">/t$/</span> does not match the 't' in "eater", but does match it in "eat".</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193214" id="1193214"></a> <span class="mono">*</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193216" id="1193216"></a> <span class="sansserif">Matches the preceding item 0 or more times.</span>
              </p>
              <p>
                <a name="1193217" id="1193217"></a> <span class="sansserif">For example, <span class="mono">/bo*/</span> matches 'boooo' in "A ghost booooed" and 'b' in "A bird warbled", but nothing in "A goat grunted".</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193219" id="1193219"></a> <span class="mono">+</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193221" id="1193221"></a> <span class="sansserif">Matches the preceding item 1 or more times. Equivalent to <span class="mono">{1,}</span>.</span>
              </p>
              <p>
                <a name="1193222" id="1193222"></a> <span class="sansserif">For example, <span class="mono">/a+/</span> matches the 'a' in "candy" and all the a's in "caaaaaaandy".</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193224" id="1193224"></a> <span class="mono">?</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193226" id="1193226"></a> <span class="sansserif">Matches the preceding item 0 or 1 time.</span>
              </p>
              <p>
                <a name="1193227" id="1193227"></a> <span class="sansserif">For example, <span class="mono">/e?le?/</span> matches the 'el' in "angel" and the 'le' in "angle."</span>
              </p>
              <p>
                <a name="1207474" id="1207474"></a> <span class="sansserif">If used immediately after any of the quantifiers <span class="mono">*</span>, <span class="mono">+</span>, <span class="mono">?</span>, or <span class="mono">{}</span>, makes the quantifier non-greedy (matching the minimum number of times), as opposed to the default, which is greedy (matching the maximum number of times).</span>
              </p>
              <p>
                <a name="1207985" id="1207985"></a> <span class="sansserif">Also used in lookahead assertions, described under (?=)<span class="mono">,</span> (?!), and (?:) in this table.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193229" id="1193229"></a> <span class="mono">.</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193231" id="1193231"></a> <span class="sansserif">(The decimal point) matches any single character except the newline character.</span>
              </p>
              <p>
                <a name="1193232" id="1193232"></a> <span class="sansserif">For example, <span class="mono">/.n/</span> matches 'an' and 'on' in "nay, an apple is on the tree", but not 'nay'.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193234" id="1193234"></a> <span class="mono">(x)</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193236" id="1193236"></a> <span class="sansserif">Matches 'x' and remembers the match. These are called capturing parentheses.</span>
              </p>
              <p>
                <a name="1193237" id="1193237"></a> <span class="sansserif">For example, <span class="mono">/(foo)/</span> matches and remembers 'foo' in "foo bar." The matched substring can be recalled from the resulting array's elements <span class="mono">[1]</span>, ..., <span class="mono">[n]</span> or from the predefined <span class="mono">RegExp</span> object's properties <span class="mono">$1</span><i>, ...,</i> <span class="mono">$9</span>.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1207782" id="1207782"></a> <span class="mono">(?:x)</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1207798" id="1207798"></a> <span class="sansserif">Matches 'x' but does not remember the match. These are called non-capturing parentheses. The matched substring can not be recalled from the resulting array's elements <span class="mono">[1]</span>, ..., <span class="mono">[n]</span> or from the predefined <span class="mono">RegExp</span> object's properties <span class="mono">$1</span><i>, ...,</i> <span class="mono">$9</span>.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1207829" id="1207829"></a> <span class="mono">x(?=y)</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1207831" id="1207831"></a> <span class="sansserif">Matches 'x' only if 'x' is followed by 'y'. For example, <span class="mono">/Jack(?=Sprat)/</span> matches 'Jack' only if it is followed by 'Sprat'. /<span class="mono">Jack(?=Sprat|Frost)/</span>matches 'Jack' only if it is followed by 'Sprat' or 'Frost'. However, neither 'Sprat' nor 'Frost' is part of the match results.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1207825" id="1207825"></a> <span class="mono">x(?!y)</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1207827" id="1207827"></a> <span class="sansserif">Matches 'x' only if 'x' is not followed by 'y'. For example, <span class="mono">/\d+(?!\.)/</span> matches a number only if it is not followed by a decimal point.<br>
                 <span class="mono">/\d+(?!\.)/.exec("3.141")</span> matches 141 but not 3.141.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193239" id="1193239"></a> <span class="mono">x|y</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193241" id="1193241"></a> <span class="sansserif">Matches either 'x' or 'y'.</span>
              </p>
              <p>
                <a name="1193242" id="1193242"></a> <span class="sansserif">For example, <span class="mono">/green|red/</span> matches 'green' in "green apple" and 'red' in "red apple."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193244" id="1193244"></a> <span class="mono">{n}</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193246" id="1193246"></a> <span class="sansserif">Where <span class="mono">n</span> is a positive integer. Matches exactly <span class="mono">n</span> occurrences of the preceding item.</span>
              </p>
              <p>
                <a name="1193247" id="1193247"></a> <span class="sansserif">For example, <span class="mono">/a{2}/</span> doesn't match the 'a' in "candy," but it matches all of the a's in "caandy," and the first two a's in "caaandy."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193249" id="1193249"></a> <span class="mono">{n,}</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193251" id="1193251"></a> <span class="sansserif">Where <span class="mono">n</span> is a positive integer. Matches at least <span class="mono">n</span> occurrences of the preceding item.</span>
              </p>
              <p>
                <a name="1193252" id="1193252"></a> <span class="sansserif">For example, <span class="mono">/a{2,}</span> doesn't match the 'a' in "candy", but matches all of the a's in "caandy" and in "caaaaaaandy."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193254" id="1193254"></a> <span class="mono">{n,m}</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193256" id="1193256"></a> <span class="sansserif">Where <span class="mono">n</span> and <span class="mono">m</span> are positive integers. Matches at least <span class="mono">n</span> and at most <span class="mono">m</span> occurrences of the preceding item.</span>
              </p>
              <p>
                <a name="1193257" id="1193257"></a> <span class="sansserif">For example, <span class="mono">/a{1,3}/</span> matches nothing in "cndy", the 'a' in "candy," the first two a's in "caandy," and the first three a's in "caaaaaaandy". Notice that when matching "caaaaaaandy", the match is "aaa", even though the original string had more a's in it.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193259" id="1193259"></a> <span class="mono">[xyz]</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193261" id="1193261"></a> <span class="sansserif">A character set. Matches any one of the enclosed characters. You can specify a range of characters by using a hyphen.</span>
              </p>
              <p>
                <a name="1193262" id="1193262"></a> <span class="sansserif">For example, <span class="mono">[abcd]</span> is the same as <span class="mono">[a-c]</span>. They match the 'b' in "brisket" and the 'c' in "ache"<span class="mono">.</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193264" id="1193264"></a> <span class="mono">[^xyz]</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193266" id="1193266"></a> <span class="sansserif">A negated or complemented character set. That is, it matches anything that is not enclosed in the brackets. You can specify a range of characters by using a hyphen.</span>
              </p>
              <p>
                <a name="1193267" id="1193267"></a> <span class="sansserif">For example, <span class="mono">[^abc]</span> is the same as <span class="mono">[^a-c]</span>. They initially match 'r' in "brisket" and 'h' in "chop."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193269" id="1193269"></a> <span class="mono">[\b]</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193271" id="1193271"></a> <span class="sansserif">Matches a backspace. (Not to be confused with <span class="mono">\b</span>.)</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193273" id="1193273"></a> <span class="mono">\b</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193275" id="1193275"></a> <span class="sansserif">Matches a word boundary, such as a space. (Not to be confused with <span class="mono">[\b]</span>.)</span>
              </p>
              <p>
                <a name="1193276" id="1193276"></a> <span class="sansserif">For example, <span class="mono">/\bn\w/</span> matches the 'no' in "noonday";<span class="mono">/\wy\b/</span> matches the 'ly' in "possibly yesterday."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193278" id="1193278"></a> <span class="mono">\B</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193280" id="1193280"></a> <span class="sansserif">Matches a non-word boundary.</span>
              </p>
              <p>
                <a name="1193281" id="1193281"></a> <span class="sansserif">For example, <span class="mono">/\w\Bn/</span> matches 'on' in "noonday", and <span class="mono">/y\B\w/</span> matches 'ye' in "possibly yesterday."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193283" id="1193283"></a> <span class="mono">\c<i>X</i></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193285" id="1193285"></a> <span class="sansserif">Where <i>X</i> is a letter from A - Z. Matches a control character in a string.</span>
              </p>
              <p>
                <a name="1193286" id="1193286"></a> <span class="sansserif">For example, <span class="mono">/\cM/</span> matches control-M in a string.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193288" id="1193288"></a> <span class="mono">\d</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193290" id="1193290"></a> <span class="sansserif">Matches a digit character. Equivalent to <span class="mono">[0-9]</span>.</span>
              </p>
              <p>
                <a name="1193291" id="1193291"></a> <span class="sansserif">For example, <span class="mono">/\d/</span> or <span class="mono">/[0-9]/</span> matches '2' in "B2 is the suite number."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193293" id="1193293"></a> <span class="mono">\D</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193295" id="1193295"></a> <span class="sansserif">Matches any non-digit character. Equivalent to <span class="mono">[^0-9]</span>.</span>
              </p>
              <p>
                <a name="1193296" id="1193296"></a> <span class="sansserif">For example, <span class="mono">/\D/</span> or <span class="mono">/[^0-9]/</span> matches 'B' in "B2 is the suite number."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193298" id="1193298"></a> <span class="mono">\f</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193300" id="1193300"></a> <span class="sansserif">Matches a form-feed.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193302" id="1193302"></a> <span class="mono">\n</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193304" id="1193304"></a> <span class="sansserif">Matches a linefeed.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193306" id="1193306"></a> <span class="mono">\r</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193308" id="1193308"></a> <span class="sansserif">Matches a carriage return.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193310" id="1193310"></a> <span class="mono">\s</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193312" id="1193312"></a> <span class="sansserif">Matches a single white space character, including space, tab, form feed, line feed. Equivalent to <span class="mono">[ \f\n\r\t\u00A0\u2028\u2029]</span>.</span>
              </p>
              <p>
                <a name="1193313" id="1193313"></a> <span class="sansserif">For example, <span class="mono">/\s\w*/</span> matches ' bar' in "foo bar."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193315" id="1193315"></a> <span class="mono">\S</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193317" id="1193317"></a> <span class="sansserif">Matches a single character other than white space. Equivalent to<br>
                 <span class="mono">[^ \f\n\r\t\u00A0\u2028\u2029]</span>.</span>
              </p>
              <p>
                <a name="1193318" id="1193318"></a> <span class="sansserif">For example, <span class="mono">/\S/\w*</span> matches 'foo' in "foo bar."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193320" id="1193320"></a> <span class="mono">\t</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193322" id="1193322"></a> <span class="sansserif">Matches a tab.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193324" id="1193324"></a> <span class="mono">\v</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193326" id="1193326"></a> <span class="sansserif">Matches a vertical tab.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193328" id="1193328"></a> <span class="mono">\w</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193330" id="1193330"></a> <span class="sansserif">Matches any alphanumeric character including the underscore. Equivalent to <span class="mono">[A-Za-z0-9_]</span>.</span>
              </p>
              <p>
                <a name="1193331" id="1193331"></a> <span class="sansserif">For example, <span class="mono">/\w/</span> matches 'a' in "apple," '5' in "$5.28," and '3' in "3D."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193333" id="1193333"></a> <span class="mono">\W</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193335" id="1193335"></a> <span class="sansserif">Matches any non-word character. Equivalent to <span class="mono">[^A-Za-z0-9_]</span>.</span>
              </p>
              <p>
                <a name="1193336" id="1193336"></a> <span class="sansserif">For example, <span class="mono">/\W/</span> or <span class="mono">/[^$A-Za-z0-9_]/</span> matches '%' in "50%."</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193338" id="1193338"></a> <span class="mono">\<i>n</i></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193340" id="1193340"></a> <span class="sansserif">Where <i>n</i> is a positive integer. A back reference to the last substring matching the <i>n</i> parenthetical in the regular expression (counting left parentheses).</span>
              </p>
              <p>
                <a name="1193341" id="1193341"></a> <span class="sansserif">For example, <span class="mono">/apple(,)\sorange\1/</span> matches 'apple, orange', in "apple, orange, cherry, peach." A more complete example follows this table.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193344" id="1193344"></a> <span class="mono">\0</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193346" id="1193346"></a> <span class="sansserif">Matches a NUL character. Do not follow this with another digit.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1208393" id="1208393"></a> <span class="mono">\xhh</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208395" id="1208395"></a> <span class="sansserif">Matches the character with the code hh (two hexadecimal digits)</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1208389" id="1208389"></a> <span class="mono">\uhhhh</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208391" id="1208391"></a> <span class="sansserif">Matches the character with code hhhh (four hexadecimal digits).</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <a name="1193347" id="1193347"></a> <span class="sansserif">The literal notation provides compilation of the regular expression when the expression is evaluated. Use literal notation when the regular expression will remain constant. For example, if you use literal notation to construct a regular expression used in a loop, the regular expression won't be recompiled on each iteration.</span>
        </p>
        <p>
          <a name="1193348" id="1193348"></a> <span class="sansserif">The constructor of the regular expression object, for example, <span class="mono">new&nbsp;RegExp("ab+c")</span>, provides runtime compilation of the regular expression. Use the constructor function when you know the regular expression pattern will be changing, or you don't know the pattern and are getting it from another source, such as user input.</span>
        </p>
        <p>
          <a name="1211678" id="1211678"></a> <span class="sansserif">A separate predefined <span class="mono">RegExp</span> object is available in each window; that is, each separate thread of JavaScript execution gets its own <span class="mono">RegExp</span> object. Because each script runs to completion without interruption in a thread, this assures that different scripts do not overwrite values of the <span class="mono">RegExp</span> object.</span>
        </p>
        <p>
          <br>
           <a name="1211719" id="1211719"></a> <a name="Property Summary" id="Property Summary"></a> <span class="sansserif"><b>Property Summary</b></span><br>
           <a name="1193394" id="1193394"></a> <span class="sansserif">Note that several of the <span class="mono">RegExp</span> properties have both long and short (Perl-like) names. Both names always refer to the same value. Perl is the programming language from which JavaScript modeled its regular expressions.</span>
        </p>
        <p>
          <a name="1203846" id="1203846"></a> <span class="sansserif"><br></span>
        </p><br>
         
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr bgcolor="#CCCCCC" align="left" valign="top">
            <th valign="top" align="left">
              <a name="1209503" id="1209503"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Property</b></span>
              </p>
            </th>
            <th valign="top" align="left">
              <a name="1209505" id="1209505"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Description</b></span>
              </p>
            </th>
          </tr>
          <tr>
            <td valign="top">
              <a name="1209577" id="1209577"></a> <span class="mono"><a href="regexp.html#1213253">constructor</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209579" id="1209579"></a> <span class="sansserif">Specifies the function that creates an object's prototype.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1209584" id="1209584"></a> <span class="mono"><a href="regexp.html#1194562">global</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209586" id="1209586"></a> <span class="sansserif">Whether to test the regular expression against all possible matches in a string, or only against the first. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1209591" id="1209591"></a> <span class="mono"><a href="regexp.html#1193678">ignoreCase</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209593" id="1209593"></a> <span class="sansserif">Whether to ignore case while attempting a match in a string. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1209605" id="1209605"></a> <span class="mono"><a href="regexp.html#1193732">lastIndex</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209607" id="1209607"></a> <span class="sansserif">The index at which to start the next match. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1209633" id="1209633"></a> <span class="mono"><a href="regexp.html#1193831">multiline</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209635" id="1209635"></a> <span class="sansserif">Whether or not to search in strings across multiple lines. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1209640" id="1209640"></a> <span class="mono"><a href="regexp.html#1200174">prototype</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209642" id="1209642"></a> <span class="sansserif">Allows the addition of properties to all objects.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1209654" id="1209654"></a> <span class="sansserif"><a href="regexp.html#1193875">source</a></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209656" id="1209656"></a> <span class="sansserif">The text of the pattern. As of JavaScript 1.5, a property of a RegExp instance, not the RegExp object.</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1193537" id="1193537"></a> <a name="Method Summary" id="Method Summary"></a> <span class="sansserif"><b>Method Summary</b></span><br>
           <a name="1193571" id="1193571"></a> <span class="sansserif"><br></span>
        </p><br>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr bgcolor="#CCCCCC" align="left" valign="top">
            <th valign="top" align="left">
              <a name="1193540" id="1193540"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Method</b></span>
              </p>
            </th>
            <th valign="top" align="left">
              <a name="1193542" id="1193542"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Description</b></span>
              </p>
            </th>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193554" id="1193554"></a> <span class="mono"><a href="regexp.html#1194735">exec</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193556" id="1193556"></a> <span class="sansserif">Executes a search for a match in its string parameter.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193561" id="1193561"></a> <span class="mono"><a href="regexp.html#1194128">test</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193563" id="1193563"></a> <span class="sansserif">Tests for a match in its string parameter.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193568" id="1193568"></a> <span class="mono"><a href="regexp.html#1194174">toSource</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193570" id="1193570"></a> <span class="sansserif">Returns an object literal representing the specified object; you can use this value to create a new object. Overrides the <a href="object.html#1193320">Object.toSource</a> method.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1199185" id="1199185"></a> <span class="mono"><a href="regexp.html#1199205">toString</a></span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1199187" id="1199187"></a> <span class="sansserif">Returns a string representing the specified object. Overrides the <a href="object.html#1193350">Object.toString</a> method.</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <a name="1200128" id="1200128"></a> <span class="sansserif">In addition, this object inherits the <a href="object.html#1193628">watch</a> and <a href="object.html#1193499">unwatch</a> methods from <a href="object.html#1193136">Object</a>.</span>
        </p>
        <p>
          <br>
           <a name="1193572" id="1193572"></a> <a name="Examples" id="Examples"></a> <span class="sansserif"><b>Examples</b></span><br>
           <a name="1193574" id="1193574"></a> <span class="sansserif"><b>Example 1.</b> The following script uses the <span class="mono">replace</span> method to switch the words in the string. In the replacement text, the script uses "$1" and "$2" to indicate the results of the corresponding matching parentheses in the regular expression pattern.</span>
        </p>
        <p>
          <a name="1193575" id="1193575"></a> <span class="mono">&lt;SCRIPT&gt;<br>
           re = /(\w+)\s(\w+)/;<br>
           str = "John Smith";<br>
           newstr=str.replace(re, "$2, $1");<br>
           document.write(newstr)<br>
           &lt;/SCRIPT&gt;</span>
        </p>
        <p>
          <a name="1193576" id="1193576"></a> <span class="sansserif">This displays "Smith, John".</span>
        </p>
        <p>
          <a name="1193578" id="1193578"></a> <span class="sansserif"><b>Example 2.</b> In the following example, <span class="mono">RegExp.input</span> is set by the Change event. In the <span class="mono">getInfo</span> function, the <span class="mono">exec</span> method uses the value of <span class="mono">RegExp.input</span> as its argument.</span>
        </p>
        <p>
          <a name="1193579" id="1193579"></a> <span class="mono">&lt;HTML&gt;</span>
        </p>
        <p>
          <a name="1193580" id="1193580"></a> <span class="mono">&lt;SCRIPT&gt;<br>
           function getInfo() {<br>
           &nbsp;&nbsp;&nbsp;re = /(\w+)\s(\d+)/;<br>
           &nbsp;&nbsp;&nbsp;var m = re.exec();<br>
           &nbsp;&nbsp;&nbsp;window.alert(m[] + ", your age is " + m[2]);<br>
           }<br>
           &lt;/SCRIPT&gt;</span>
        </p>
        <p>
          <a name="1193581" id="1193581"></a> <span class="mono">Enter your first name and your age, and then press Enter.</span>
        </p>
        <p>
          <a name="1193582" id="1193582"></a> <span class="mono">&lt;FORM&gt;<br>
           &lt;INPUT TYPE:"TEXT" NAME="NameAge" onChange="getInfo(this);"&gt;<br>
           &lt;/FORM&gt;</span>
        </p>
        <p>
          <a name="1193583" id="1193583"></a> <span class="mono">&lt;/HTML&gt;</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1213253" id="1213253"></a> <a name="constructor" id="constructor"></a> <span class="sansserif"><b>constructor</b></span>
        </p>
        <p>
          <a name="1200249" id="1200249"></a> <span class="sansserif">Specifies the function that creates an object's prototype. Note that the value of this property is a reference to the function itself, not a string containing the function's name.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1200252" id="1200252"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1200257" id="1200257"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1200259" id="1200259"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1200261" id="1200261"></a> <span class="sansserif">JavaScript 1.1, NES 2.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1200263" id="1200263"></a> <span class="sansserif"><i>ECMA version</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1200265" id="1200265"></a> <span class="sansserif">ECMA-262</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1200266" id="1200266"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1200270" id="1200270"></a> <span class="sansserif">See <a href="object.html#1193229">Object.constructor</a>.</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1194735" id="1194735"></a> <a name="exec" id="exec"></a> <span class="sansserif"><b>exec</b></span>
        </p>
        <p>
          <a name="1194748" id="1194748"></a> <span class="sansserif">Executes the search for a match in a specified string. Returns a result array.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1194738" id="1194738"></a> <span class="sansserif"><i>Method of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194743" id="1194743"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1194745" id="1194745"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194747" id="1194747"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1208475" id="1208475"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208477" id="1208477"></a> <span class="sansserif">ECMA 262, Edition 3 (first syntax only)</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1194749" id="1194749"></a> <a name="Syntax" id="Syntax"></a> <span class="sansserif"><b>Syntax</b></span><br>
           <a name="1194750" id="1194750"></a> <span class="mono"><i>regexp</i>.exec([<i>str</i>])<br>
           <i>regexp</i>([<i>str</i>])</span>
        </p>
        <p>
          <br>
           <a name="1194751" id="1194751"></a> <a name="Parameters" id="Parameters"></a> <span class="sansserif"><b>Parameters</b></span><br>
           <a name="1194764" id="1194764"></a> <span class="sansserif"><br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <a name="1194754" id="1194754"></a> <span class="mono">regexp</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194756" id="1194756"></a> <span class="sansserif"><span class="mono">The</span> name of the regular expression. It can be a variable name or a literal.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194758" id="1194758"></a> <span class="mono">str</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194760" id="1194760"></a> <span class="sansserif">The string against which to match the regular expression.</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1194765" id="1194765"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1194766" id="1194766"></a> <span class="sansserif">As shown in the syntax description, a regular expression's <span class="mono">exec</span> method can be called either directly, (with <span class="mono">regexp.exec(str)</span>) or indirectly (with <span class="mono">regexp(str)</span>).</span>
        </p>
        <p>
          <a name="1194770" id="1194770"></a> <span class="sansserif">If you are executing a match simply to find <span class="mono">true</span> or <span class="mono">false</span>, use the <a href="regexp.html#1194128">test</a> method or the <span class="mono">String</span> <a href="string.html#1194332">search</a> method.</span>
        </p>
        <p>
          <a name="1194774" id="1194774"></a> <span class="sansserif">If the match succeeds, the <span class="mono">exec</span> method returns an array and updates properties of the regular expression object. If the match fails, the <span class="mono">exec</span> method returns <span class="mono">null</span>.</span>
        </p>
        <p>
          <a name="1194775" id="1194775"></a> <span class="sansserif">Consider the following example:</span>
        </p>
        <p>
          <a name="1194776" id="1194776"></a> <span class="mono">&lt;SCRIPT LANGUAGE="JavaScript1.2"&gt;<br>
           //Match one d followed by one or more b's followed by one d<br>
           //Remember matched b's and the following d<br>
           //Ignore case<br>
           myRe=/d(b+)(d)/ig;<br>
           myArray = myRe.exec("cdbBdbsbz");<br>
           &lt;/SCRIPT&gt;</span>
        </p>
        <p>
          <a name="1194898" id="1194898"></a> <span class="sansserif">The following table shows the results for this script:</span>
        </p>
        <p>
          <a name="1195304" id="1195304"></a> <span class="sansserif"><br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr bgcolor="#CCCCCC" align="left" valign="top">
            <th valign="top" align="left">
              <a name="1194779" id="1194779"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Object</b></span>
              </p>
            </th>
            <th valign="top" align="left">
              <a name="1194781" id="1194781"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Property/Index</b></span>
              </p>
            </th>
            <th valign="top" align="left">
              <a name="1194783" id="1194783"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Description</b></span>
              </p>
            </th>
            <th valign="top" align="left">
              <a name="1194785" id="1194785"></a> 
              <p class="alignleft">
                <span class="sansserif"><b>Example</b></span>
              </p>
            </th>
          </tr>
          <tr>
            <td valign="top" colspan="1" rowspan="5">
              <a name="1194787" id="1194787"></a> <span class="mono">myArray</span>
            </td>
            <td valign="top">
              <a name="1194789" id="1194789"></a> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194791" id="1194791"></a> <span class="sansserif">The contents of <span class="mono">myArray.</span></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194793" id="1194793"></a> <span class="sansserif"><span class="mono">["dbBd", "bB", "d"]</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194797" id="1194797"></a> <span class="mono">index</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194799" id="1194799"></a> <span class="sansserif">The 0-based index of the match in the string.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194801" id="1194801"></a> <span class="sansserif"><span class="mono">1</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194805" id="1194805"></a> <span class="mono">input</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194807" id="1194807"></a> <span class="sansserif">The original string.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194809" id="1194809"></a> <span class="sansserif"><span class="mono">cdbBdbsbz</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194813" id="1194813"></a> <span class="mono">[0]</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194815" id="1194815"></a> <span class="sansserif">The last matched characters.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194817" id="1194817"></a> <span class="sansserif"><span class="mono">dbBd</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194821" id="1194821"></a> <span class="mono">[1], ...[<i>n</i>]</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194823" id="1194823"></a> <span class="sansserif">The parenthesized substring matches, if any. The number of possible parenthesized substrings is unlimited.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194825" id="1194825"></a> <span class="sansserif"><span class="mono">[1] = bB<br>
                 [2] = d</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top" colspan="1" rowspan="5">
              <a name="1194827" id="1194827"></a> <span class="mono">myRe</span>
            </td>
            <td valign="top">
              <a name="1194829" id="1194829"></a> <span class="mono">lastIndex</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194831" id="1194831"></a> <span class="sansserif">The index at which to start the next match.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194833" id="1194833"></a> <span class="sansserif"><span class="mono">5</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194837" id="1194837"></a> <span class="mono">ignoreCase</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194839" id="1194839"></a> <span class="sansserif">Indicates if the <span class="mono">"i"</span> flag was used to ignore case.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194841" id="1194841"></a> <span class="sansserif"><span class="mono">true</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194845" id="1194845"></a> <span class="mono">global</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194847" id="1194847"></a> <span class="sansserif">Indicates if the <span class="mono">"g"</span> flag was used for a global match.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194849" id="1194849"></a> <span class="sansserif"><span class="mono">true</span></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1208547" id="1208547"></a> <span class="mono">multiline</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208563" id="1208563"></a> <span class="sansserif">Indicates if the <span class="mono">"m"</span> flag was used for a global match.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208551" id="1208551"></a> <span class="sansserif">false</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194853" id="1194853"></a> <span class="mono">source</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194855" id="1194855"></a> <span class="sansserif">The text of the pattern.</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194857" id="1194857"></a> <span class="sansserif"><span class="mono">d(b+)(d)</span></span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <a name="1194899" id="1194899"></a> <span class="sansserif">If your regular expression uses the <span class="mono">"g"</span> flag, you can use the <span class="mono">exec</span> method multiple times to find successive matches in the same string. When you do so, the search starts at the substring of <span class="mono">str</span> specified by the regular expression's <span class="mono">lastIndex</span> property. For example, assume you have this script:</span>
        </p>
        <p>
          <a name="1194900" id="1194900"></a> <span class="mono">&lt;SCRIPT LANGUAGE="JavaScript1.2"&gt;<br>
           myRe=/ab*/g;<br>
           str = "abbcdefabh";<br>
           myArray = myRe.exec(str);<br>
           document.writeln("Found " + myArray[0] +<br>
           &nbsp;&nbsp;&nbsp;". Next match starts at " + myRe.lastIndex)<br>
           mySecondArray = myRe.exec(str);<br>
           document.writeln("Found " + mySecondArray[0] +<br>
           &nbsp;&nbsp;&nbsp;". Next match starts at " + myRe.lastIndex)<br>
           &lt;/SCRIPT&gt;</span>
        </p>
        <p>
          <a name="1194901" id="1194901"></a> <span class="sansserif">This script displays the following text:</span>
        </p>
        <p>
          <a name="1194902" id="1194902"></a> <span class="sansserif">Found <span class="mono">abb</span>. Next match starts at 3<br>
           Found ab. Next match starts at 9</span>
        </p>
        <p>
          <br>
           <a name="1194903" id="1194903"></a> <a name="Examples" id="Examples"></a> <span class="sansserif"><b>Examples</b></span><br>
           <a name="1194904" id="1194904"></a> <span class="sansserif">In the following example, the user enters a name and the script executes a match against the input. It then cycles through the array to see if other names match the user's name.</span>
        </p>
        <p>
          <a name="1194905" id="1194905"></a> <span class="sansserif">This script assumes that first names of registered party attendees are preloaded into the array A, perhaps by gathering them from a party database.</span>
        </p>
        <p>
          <a name="1194906" id="1194906"></a> <span class="mono">&lt;HTML&gt;</span>
        </p>
        <p>
          <a name="1194907" id="1194907"></a> <span class="mono">&lt;SCRIPT LANGUAGE="JavaScript1.2"&gt;<br>
           A = ["Frank", "Emily", "Jane", "Harry", "Nick", "Beth", "Rick",<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Terrence", "Carol", "Ann", "Terry", "Frank", "Alice", "Rick",<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"Bill", "Tom", "Fiona", "Jane", "William", "Joan", "Beth"]</span>
        </p>
        <p>
          <a name="1194908" id="1194908"></a> <span class="mono">function lookup() {<br>
           &nbsp;&nbsp;&nbsp;firstName = /\w+/i();<br>
           &nbsp;&nbsp;&nbsp;if (!firstName)<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.alert (RegExp.input + " isn't a name!");<br>
           &nbsp;&nbsp;&nbsp;else {<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;count = 0;<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (i=0; i&lt;A.length; i++)<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (firstName[0].toLowerCase() == A[i].toLowerCase()) count++;<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (count ==1)<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;midstring = " other has ";<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;else<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;midstring = " others have ";<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;window.alert ("Thanks, " + count + midstring + "the same name!")<br>
           &nbsp;&nbsp;&nbsp;}<br>
           }</span>
        </p>
        <p>
          <a name="1194909" id="1194909"></a> <span class="mono">&lt;/SCRIPT&gt;</span>
        </p>
        <p>
          <a name="1194910" id="1194910"></a> <span class="mono">Enter your first name and then press Enter.</span>
        </p>
        <p>
          <a name="1194911" id="1194911"></a> <span class="mono">&lt;FORM&gt; &lt;INPUT TYPE:"TEXT" NAME="FirstName" onChange="lookup(this);"&gt; &lt;/ FORM&gt;</span>
        </p>
        <p>
          <a name="1194912" id="1194912"></a> <span class="mono">&lt;/HTML&gt;</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1194562" id="1194562"></a> <a name="global" id="global"></a> <span class="sansserif"><b>global</b></span>
        </p>
        <p>
          <a name="1193669" id="1193669"></a> <span class="sansserif">Whether or not the <span class="mono">"g"</span> flag is used with the regular expression.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1193655" id="1193655"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193660" id="1193660"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a> instances</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top" colspan="2" rowspan="1">
              <p>
                <a name="1193662" id="1193662"></a> <span class="sansserif"><i>Read-only</i></span>
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1193666" id="1193666"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193668" id="1193668"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1208798" id="1208798"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1208800" id="1208800"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1193670" id="1193670"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1193671" id="1193671"></a> <span class="sansserif"><span class="mono">global</span> is a property of an individual regular expression object.</span>
        </p>
        <p>
          <a name="1193672" id="1193672"></a> <span class="sansserif">The value of <span class="mono">global</span> is <span class="mono">true</span> if the <span class="mono">"g"</span> flag was used; otherwise, <span class="mono">false</span>. The <span class="mono">"g"</span> flag indicates that the regular expression should be tested against all possible matches in a string.</span>
        </p>
        <p>
          <a name="1193676" id="1193676"></a> <span class="sansserif">You cannot change this property directly.</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1193678" id="1193678"></a> <a name="ignoreCase" id="ignoreCase"></a> <span class="sansserif"><b>ignoreCase</b></span>
        </p>
        <p>
          <a name="1193695" id="1193695"></a> <span class="sansserif">Whether or not the <span class="mono">"i"</span> flag is used with the regular expression.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1193681" id="1193681"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193686" id="1193686"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a> instances</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top" colspan="2" rowspan="1">
              <p>
                <a name="1193688" id="1193688"></a> <span class="sansserif"><i>Read-only</i></span>
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1193692" id="1193692"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193694" id="1193694"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1209071" id="1209071"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209073" id="1209073"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1193696" id="1193696"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1193697" id="1193697"></a> <span class="sansserif"><span class="mono">ignoreCase</span> is a property of an individual regular expression object.</span>
        </p>
        <p>
          <a name="1193698" id="1193698"></a> <span class="sansserif">The value of <span class="mono">ignoreCase</span> is <span class="mono">true</span> if the <span class="mono">"i"</span> flag was used; otherwise, <span class="mono">false</span>. The <span class="mono">"i"</span> flag indicates that case should be ignored while attempting a match in a string.</span>
        </p>
        <p>
          <a name="1193702" id="1193702"></a> <span class="sansserif">You cannot change this property directly.</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1193732" id="1193732"></a> <a name="lastIndex" id="lastIndex"></a> <span class="sansserif"><b>lastIndex</b></span>
        </p>
        <p>
          <a name="1193733" id="1193733"></a> <span class="sansserif">A read/write integer property that specifies the index at which to start the next match.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1193736" id="1193736"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193741" id="1193741"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a> instances</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1193743" id="1193743"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193745" id="1193745"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1209083" id="1209083"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209085" id="1209085"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1193746" id="1193746"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1193747" id="1193747"></a> <span class="sansserif"><span class="mono">lastIndex</span> is a property of an individual regular expression object.</span>
        </p>
        <p>
          <a name="1193748" id="1193748"></a> <span class="sansserif">This property is set only if the regular expression used the <span class="mono">"g"</span> flag to indicate a global search. The following rules apply:</span>
        </p>
        <ul>
          <li class="nobullet">
            <a name="1193749" id="1193749"></a>
          </li>
          <li>
            <span class="sansserif">If <span class="mono">lastIndex</span> is greater than the length of the string, <span class="mono">regexp.test</span> and <span class="mono">regexp.exec</span> fail, and <span class="mono">lastIndex</span> is set to <span class="mono">0</span>.</span> 
            <p>
              <a name="1193750" id="1193750"></a>
            </p>
          </li>
          <li>
            <span class="sansserif">If <span class="mono">lastIndex</span> is equal to the length of the string and if the regular expression matches the empty string, then the regular expression matches input starting at <span class="mono">lastIndex</span> <i>.</i></span> 
            <p>
              <a name="1193751" id="1193751"></a>
            </p>
          </li>
          <li>
            <span class="sansserif">If <span class="mono">lastIndex</span> is equal to the length of the string and if the regular expression does not match the empty string, then the regular expression mismatches input, and <span class="mono">lastIndex</span> is reset to 0.</span> 
            <p>
              <a name="1193752" id="1193752"></a>
            </p>
          </li>
          <li>
            Otherwise, <span class="mono">lastIndex</span> is set to the next position following the most recent match.
          </li>
        </ul><a name="1193766" id="1193766"></a> <span class="sansserif">For example, consider the following sequence of statements:</span> 
        <p>
          <a name="1195330" id="1195330"></a> <span class="sansserif"><br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <a name="1193755" id="1193755"></a> <span class="mono">re = /(hi)?/g</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193757" id="1193757"></a> <span class="sansserif">Matches the empty string.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193759" id="1193759"></a> <span class="mono">re("hi")</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193761" id="1193761"></a> <span class="sansserif">Returns <span class="mono">["hi", "hi"]</span> with <span class="mono">lastIndex</span> equal to <span class="mono">2</span>.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1193763" id="1193763"></a> <span class="mono">re("hi")</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193765" id="1193765"></a> <span class="sansserif">Returns <span class="mono">[""]</span>, an empty array whose zeroth element is the match string. In this case, the empty string because <span class="mono">lastIndex</span> was 2 (and still is 2) and <span class="mono">"hi"</span> has length 2.</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
        </p>
        <p>
          <a name="1193831" id="1193831"></a> <a name="multiline" id="multiline"></a> <span class="sansserif"><b>multiline</b></span>
        </p>
        <p>
          <a name="1193832" id="1193832"></a> <span class="sansserif">Reflects whether or not to search in strings across multiple lines.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1193835" id="1193835"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193840" id="1193840"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a> instances</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top" colspan="2" rowspan="1">
              <p>
                <a name="1193842" id="1193842"></a> <span class="sansserif"><i>Static</i></span>
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1193846" id="1193846"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193848" id="1193848"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1209112" id="1209112"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209114" id="1209114"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1193849" id="1193849"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1207478" id="1207478"></a> <span class="sansserif"><span class="mono">multiline</span> is a property of an individual regular expression object..</span>
        </p>
        <p>
          <a name="1207512" id="1207512"></a> <span class="sansserif">The value of <span class="mono">multiline</span> is <span class="mono">true</span> if the <span class="mono">"m"</span> flag was used; otherwise, <span class="mono">false</span>. The <span class="mono">"m"</span> flag indicates that a multiline input string should be treated as multiple lines. For example, if <span class="mono">"m"</span> is used, <span class="mono">"^"</span> and <span class="mono">"$"</span> change from matching at only the start or end of the entire string to the start or end of any line within the string.</span>
        </p>
        <p>
          <a name="1207483" id="1207483"></a> <span class="sansserif">You cannot change this property directly.</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1200174" id="1200174"></a> <a name="prototype" id="prototype"></a> <span class="sansserif"><b>prototype</b></span>
        </p>
        <p>
          <a name="1200175" id="1200175"></a> <span class="sansserif">Represents the prototype for this class. You can use the prototype to add properties or methods to all instances of a class. For information on prototypes, see <a href="function.html#1193426">Function.prototype</a>.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1200181" id="1200181"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1200186" id="1200186"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1200188" id="1200188"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1200190" id="1200190"></a> <span class="sansserif">JavaScript 1.1, NES 2.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1200192" id="1200192"></a> <span class="sansserif"><i>ECMA version</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1200194" id="1200194"></a> <span class="sansserif">ECMA-262</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
        </p>
        <p>
          <a name="1193875" id="1193875"></a> <a name="source" id="source"></a> <span class="sansserif"><b>source</b></span>
        </p>
        <p>
          <a name="1193876" id="1193876"></a> <span class="sansserif">A read-only property that contains the text of the pattern, excluding the forward slashes.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1193879" id="1193879"></a> <span class="sansserif"><i>Property of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193884" id="1193884"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a> instances</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top" colspan="2" rowspan="1">
              <p>
                <a name="1193886" id="1193886"></a> <span class="sansserif"><i>Read-only</i></span>
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1193890" id="1193890"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1193892" id="1193892"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1209149" id="1209149"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209151" id="1209151"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1193893" id="1193893"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1193894" id="1193894"></a> <span class="sansserif"><span class="mono">source</span> is a property of an individual regular expression object.</span>
        </p>
        <p>
          <a name="1193898" id="1193898"></a> <span class="sansserif">You cannot change this property directly.</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1194128" id="1194128"></a> <a name="test" id="test"></a> <span class="sansserif"><b>test</b></span>
        </p>
        <p>
          <a name="1194129" id="1194129"></a> <span class="sansserif">Executes the search for a match between a regular expression and a specified string. Returns <span class="mono">true</span> or <span class="mono">false</span>.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1194132" id="1194132"></a> <span class="sansserif"><i>Method of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194137" id="1194137"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1194139" id="1194139"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194141" id="1194141"></a> <span class="sansserif">JavaScript 1.2, NES 3.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1209157" id="1209157"></a> <span class="sansserif">ECMA version</span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1209159" id="1209159"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1194142" id="1194142"></a> <a name="Syntax" id="Syntax"></a> <span class="sansserif"><b>Syntax</b></span><br>
           <a name="1194143" id="1194143"></a> <span class="mono"><i>regexp</i>.test([<i>str</i>])</span>
        </p>
        <p>
          <br>
           <a name="1194144" id="1194144"></a> <a name="Parameters" id="Parameters"></a> <span class="sansserif"><b>Parameters</b></span><br>
           <a name="1194157" id="1194157"></a> <span class="sansserif"><br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <a name="1194147" id="1194147"></a> <span class="mono">regexp</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194149" id="1194149"></a> <span class="sansserif"><span class="mono">The</span> name of the regular expression. It can be a variable name or a literal.</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <a name="1194151" id="1194151"></a> <span class="mono">str</span> 
              <p>
                &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194153" id="1194153"></a> <span class="sansserif">The string against which to match the regular expression.</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1194158" id="1194158"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1194159" id="1194159"></a> <span class="sansserif">When you want to know whether a pattern is found in a string use the <span class="mono">test</span> method (similar to the <a href="string.html#1194332">String.search</a> method); for more information (but slower execution) use the <a href="regexp.html#1194735">exec</a> method (similar to the <a href="string.html#1205239">String.match</a> method).</span>
        </p>
        <p>
          <br>
           <a name="1194169" id="1194169"></a> <a name="Example" id="Example"></a> <span class="sansserif"><b>Example</b></span><br>
           <a name="1194170" id="1194170"></a> <span class="sansserif">The following example prints a message which depends on the success of the test:</span>
        </p>
        <p>
          <a name="1194171" id="1194171"></a> <span class="mono">function testinput(re, str){<br>
           &nbsp;&nbsp;&nbsp;if (re.test(str))<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;midstring = " contains ";<br>
           &nbsp;&nbsp;&nbsp;else<br>
           &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;midstring = " does not contain ";<br>
           &nbsp;&nbsp;&nbsp;document.write (str + midstring + re.source);<br>
           }</span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1194174" id="1194174"></a> <a name="toSource" id="toSource"></a> <span class="sansserif"><b>toSource</b></span>
        </p>
        <p>
          <a name="1194176" id="1194176"></a> <span class="sansserif">Returns a string representing the source code of the object.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1194179" id="1194179"></a> <span class="sansserif"><i>Method of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194184" id="1194184"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1194186" id="1194186"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1194188" id="1194188"></a> <span class="sansserif">JavaScript 1.3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1194189" id="1194189"></a> <a name="Syntax" id="Syntax"></a> <span class="sansserif"><b>Syntax</b></span><br>
           <a name="1194190" id="1194190"></a> <span class="mono">toSource()</span>
        </p>
        <p>
          <br>
           <a name="1194191" id="1194191"></a> <a name="Parameters" id="Parameters"></a> <span class="sansserif"><b>Parameters</b></span><br>
           <a name="1194192" id="1194192"></a> <span class="sansserif">None</span>
        </p>
        <p>
          <br>
           <a name="1194193" id="1194193"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1201585" id="1201585"></a> <span class="sansserif">The <span class="mono">toSource</span> method returns the following values:</span>
        </p>
        <ul>
          <li class="nobullet">
            <a name="1201586" id="1201586"></a>
          </li>
          <li>
            <span class="sansserif">For the built-in <span class="mono">RegExp</span> object, <span class="mono">toSource</span> returns the following string indicating that the source code is not available:</span> 
            <p>
              <a name="1201587" id="1201587"></a> <span class="mono">&nbsp;&nbsp;&nbsp;function Boolean() {<br>
               &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;[native code]<br>
               &nbsp;&nbsp;&nbsp;}</span>
            </p>
            <p>
              <a name="1201588" id="1201588"></a>
            </p>
          </li>
          <li>
            For instances of <span class="mono">RegExp</span>, <span class="mono">toSource</span> returns a string representing the source code.
          </li>
        </ul><a name="1201589" id="1201589"></a> <span class="sansserif">This method is usually called internally by JavaScript and not explicitly in code.</span> 
        <p>
          <br>
           <a name="1199455" id="1199455"></a> <a name="See also" id="See also"></a> <span class="sansserif"><b>See also</b></span><br>
           <a name="1199459" id="1199459"></a> <span class="sansserif"><a href="object.html#1193320">Object.toSource</a></span>
        </p>
        <p>
          <br>
        </p>
        <p>
          <a name="1199205" id="1199205"></a> <a name="toString" id="toString"></a> <span class="sansserif"><b>toString</b></span>
        </p>
        <p>
          <a name="1199222" id="1199222"></a> <span class="sansserif">Returns a string representing the specified object.<br></span>
        </p>
        <p>
          <br>
          <br>
        </p>
        <table width="90%" border="1" cellpadding="5" cellspacing="0">
          <tr>
            <td valign="top">
              <p>
                <a name="1199208" id="1199208"></a> <span class="sansserif"><i>Method of</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1199213" id="1199213"></a> <span class="sansserif"><a href="regexp.html#1193136">RegExp</a></span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1199215" id="1199215"></a> <span class="sansserif"><i>Implemented in</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1199217" id="1199217"></a> <span class="sansserif">JavaScript 1.1, NES 2.0</span> &nbsp;
              </p>
            </td>
          </tr>
          <tr>
            <td valign="top">
              <p>
                <a name="1199219" id="1199219"></a> <span class="sansserif"><i>ECMA version</i></span> &nbsp;
              </p>
            </td>
            <td valign="top">
              <p>
                <a name="1199221" id="1199221"></a> <span class="sansserif">ECMA 262, Edition 3</span> &nbsp;
              </p>
            </td>
          </tr>
        </table>
        <p>
          <br>
           <a name="1199223" id="1199223"></a> <a name="Syntax" id="Syntax"></a> <span class="sansserif"><b>Syntax</b></span><br>
           <a name="1199224" id="1199224"></a> <span class="mono">toString()</span>
        </p>
        <p>
          <br>
           <a name="1199225" id="1199225"></a> <a name="Parameters" id="Parameters"></a> <span class="sansserif"><b>Parameters</b></span><br>
           <a name="1199226" id="1199226"></a> <span class="sansserif">None.</span>
        </p>
        <p>
          <br>
           <a name="1199227" id="1199227"></a> <a name="Description" id="Description"></a> <span class="sansserif"><b>Description</b></span><br>
           <a name="1199234" id="1199234"></a> <span class="sansserif">The <a href="regexp.html#1193136">RegExp</a> object overrides the <span class="mono">toString</span> method of the <a href="object.html#1193136">Object</a> object; it does not inherit <a href="object.html#1193350">Object.toString</a>. For <a href="regexp.html#1193136">RegExp</a> objects, the <span class="mono">toString</span> method returns a string representation of the object.</span>
        </p>
        <p>
          <br>
           <a name="1199500" id="1199500"></a> <a name="Examples" id="Examples"></a> <span class="sansserif"><b>Examples</b></span><br>
           <a name="1199501" id="1199501"></a> <span class="sansserif">The following example displays the string value of a RegExp object:</span>
        </p>
        <p>
          <a name="1199512" id="1199512"></a> <span class="mono">myExp = new RegExp("a+b+c");<br>
           alert(myExp.toString())&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;displays "/a+b+c/"</span>
        </p>
        <p>
          <br>
           <a name="1199247" id="1199247"></a> <a name="See also" id="See also"></a> <span class="sansserif"><b>See also</b></span><br>
           <a name="1199251" id="1199251"></a> <span class="sansserif"><a href="object.html#1193350">Object.toString</a></span>
        </p>
        <p>
          <a name="1199297" id="1199297"></a>
        </p>
      </align>
      <blockquote>
        <br>
         <b><a class="sansserifPurple" href="packages.html">Previous</a></b>&nbsp;&nbsp;&nbsp;&nbsp; <a href="contents.html"><b class="sansserifPurple">Contents</b></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="ix.html"><b class="sansserifPurple">Index</b></a>&nbsp;&nbsp;&nbsp;&nbsp; <a href="string.html"><b class="sansserifPurple">Next</b></a> &nbsp;&nbsp;&nbsp;&nbsp; 
        <hr noshade="noshade" size="1">
        <span class="sansserif">Copyright &#169; 2000 <a href="http://www.netscape.com">Netscape Communications Corp.</a> All rights reserved.</span>
      </blockquote>
      <p class="alignright">
        Last Updated <b>September 28, 2000</b>
      </p>
      <table width="90%" border="1" cellpadding="5" cellspacing="0"></table>
    </blockquote>
  </body>
</html>
